<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/tips.js"></script>
<script src="${staticServer}/js/web/consultant_client_tracking_list.js?1.0"></script>

<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script>
var contextPath='${contextPath}';

$(function(){
	$("#sources").val("${reception.source}");
	$("#name1").val("${name1}");
	$("#bank_id").val("${bank_id}");
	$("#center").val("${center}");
});

function starquery(type)
{
	var url = "${contextPath}/index/system_reception_moneylist.htm";
	var ps = param(location.href);
	
	if(type==0)
	{
		var client = $("#client").val();
		var user = $("#user").val();
		var worth = $("#worth").val();
		var isreserve = $("#isreserve").val();
		var phone = $("#phone").val();
		var email = $("#email").val();
		var qq = $("#qq").val();
		var param_str = "";
		var source = $("#sources").val();
		var student = $("#student").val();
		var name1 = $("#name1").val();
		var bank_id = $("#bank_id").val();
		var startTime = $("#startTime").val();
		var endTime = $("#endTime").val();
		var center = $("#center").val();
		
		if(!empty(student)) param_str +="&stnickname=" +student;
		if(!empty(client)) param_str += "&knickname=" + client;
		if(!empty(user)) param_str += "&snickname=" + user;
		if(!empty(worth)) param_str += "&worth=" + worth;
		if(!empty(isreserve) || isreserve==0) param_str += "&rkey=" + isreserve;
		if(!empty(phone)) param_str += "&phone=" + phone;
		if(!empty(email)) param_str += "&email=" + email;
		if(!empty(qq)) param_str += "&qq=" + qq;
		if(!empty(source)) param_str +="&source="+source;
		if(!empty(name1)) param_str +="&name1="+name1;
		if(!empty(bank_id)) param_str +="&bank_id="+bank_id;
		if(!empty(startTime)) param_str +="&startTime="+startTime;
		if(!empty(endTime)) param_str +="&endTime="+endTime;
		if(!empty(center)) param_str +="&center="+center;
		url = "?" + param_str;
	}
	else
	{
		url = "?";
	}

	if(!empty(ps.invalid))url+="&invalid="+ps.invalid;
	
	location.href = url;
}

var getFollow = function(keyname,id){
	$("#traId").val(id);
	$.post("${contextPath}/index/get_client_follow.json", {
		"keyname":keyname
	}, function(ms) {
		var list = ms.list;
		var objHtml = "";
		$("#trackList"+id).val("");
		if(list!=null){
			var j=0;
			for(var i=0;i<list.length;i++){
				var state = "";
				if(list[i].state=="" || list[i].state==null){
					state = '<a class="stateitem caption">无变化</a>';
				}else{
					state = '<a class="stateitem">'+list[i].state+'</a>';
				}
				if(list[i].state2=="" || list[i].state2==null){
					state2 = '';
				}else{
					state2 = '<a class="stateitem">'+list[i].state2+'</a>';
				}
				if(list[i].state3=="" || list[i].state3==null){
					state3 = '';
				}else{
					state3 = '<a class="stateitem">'+list[i].state3+'</a>';
				}
				objHtml += '<ul>'+
	            			'<li>'+
	            				'<p class="trackingtitle" style="display: block;">第 '+(++j)+' 次跟踪记录<em class="caption">（负责人：'+list[i].nickname+'　日期：'+list[i].createTime+'）</em><a class="btnHidden"></a></p>'+
	            				'<p class="trackingstate" style="display: block;"><b>客户状态</b><span>'+state+state2+state3+'</span></p>'+
	            				'<p style="display: block;"><b>备注情况</b></p>'+
	            				'<div class="content" style="display: block;">'+list[i].remark+'</div>'+
	            			'</li>'+
	            		'</ul>'
			}
			$("#trackList"+id).html('<a class="stress unit" onclick="remove_tracking()"> 点击隐藏跟踪记录 </a>'+objHtml);
			$("#__TRACKING_LIST"+id).show();
		}
		
	});
}

var remove_tracking = function(){
	var id = $("#traId").val();
	$("#__TRACKING_LIST"+id).hide();
}

function getXiaZaiShuju(){
	var center = $("#center").val();
	var name1 = $("#name1").val();
	var bank_id = $("#bank_id").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	if(startTime==""){
		alert("开始时间不能为空");
		return;
	}
	$.post('${contextPath}/index/xiaz_reception_money.json',{
		center:center,
		name1:name1,
		bank_id:bank_id,
		startTime:startTime,
		endTime:endTime
	},function(data){
		if(data){
			if(data.name!=null){
				window.location.href = "http://www.yueqiao.org/mydata/uploadtea/xls/"+data.name;
			}
		}
	});
}
</script>
</head>

<body>
<input type="hidden" id="traId" value="">
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>咨询师业务管理</li>
			<li>&gt;</li>
			<li class="current">客户接待查询</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table class="simple_table" rel="nohover" style="min-width: 750px;">
			<tr>
				<td>
				<label for="client">客户名字：</label> 
				<input type="text" id="client" size="15" placeholder="客户名字" value="${reception.knickname}" /> 
				<label for="user">接待老师：</label> 
				<input type="text" id="user" size="15" value="${reception.snickname}" placeholder="接待老师名字" />
                <label for="phone">学员名字：</label> 
				<input type="text" id="student" size="15" placeholder="学员名字" value="${reception.stnickname}" />
               	<label for="phone">联系电话：</label> 
				<input type="text" id="phone" size="15" placeholder="客户联系电话" value="${reception.phone}" />
				<br/>
				<label for="phone">中心地址：</label> 
				<select id="center">
					<option value="">全部</option>
					<#if rList??>
					<#list rList as list>
						<option value="${list.name}">${list.name}</option>
					</#list>
					</#if>
				<select>
				<label for="phone">支付方式：</label> 
				<select id="name1">
					<option value="">全部</option>
					<option value="支付宝">支付宝</option>
					<option value="POS刷卡">POS刷卡</option>
					<option value="银行卡">银行卡</option>
					<option value="现金">现金</option>
					<option value="POS刷卡（备用）">POS刷卡（备用）</option>
				<select>
				<select id="bank_id">
					<option value="">全部</option>
					<#if mList??>
					<#list mList as list>
						<option value="${list.bank_id}">${list.bank_id}</option>
					</#list>
					</#if>
				<select>
				<br/>
				<label for="phone">开始时间：</label> 
				<input type="text" id="startTime" rel="DATE::Y-m-d" value="${startTime}" size="15" maxlength="15" readonly="readonly" class="DatePicker_Icon">
               	<label for="phone">结束时间：</label> 
               	<input type="text" id="endTime" rel="DATE::Y-m-d" value="${endTime}" size="15" maxlength="15" readonly="readonly" class="DatePicker_Icon">
               	
               	</td>
              	<td rowspan="4"><input type="button" value=" 查 询 " onclick="starquery(0)" />
				<input type="button" value=" 重 置 " onclick="starquery(1)" />
				<input type="button" value=" 下 载 " onclick="getXiaZaiShuju()" /></td>
				
			</tr>
		</table>
		<table>
			<tr class="fields">
				<th width="100">接待老师</th>
				<th width="100">客户姓名</th>
				<th width="100">接待日期</th>
				<th>联系方式</th>
				<th>测评中心</th>
				<th width="280">交款金额</th>
				<th width="100">备注</th>
				<th width="100">凭证</th>
			</tr>
			
			<#if list??>
				<#list list as list>
					<tr class="even_row">
						<td align="center">${list.receptionns}</td>
						<td align="center" id="${list.keyname}" name="${list.keyname}" class="stress">${list.nickname}<em class="valid">（有效）</em></td>
						<td align="center"><#if list.gtime??>${list.gtime}</#if></td>
						
						<td align="center">
						<#if list.phlist??>
							<#list list.phlist as phlist>
							<a title="<#if phlist.phone!="">电话：${phlist.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
							<#assign phone1 = "${phlist.phone}">
							<#if phlist.name=="爸爸" || phlist.name=="妈妈">
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.name}</br>
							<#elseif phlist.guanxi!="">
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.guanxi}</br>
							<#else>
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.name}</br>
							</#if>
							</a>
     						</#list>
     						<#else>
						<a title="<#if list.phone!="" && list.phone?contains('[]')==false>电话：${list.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
     						<#if list.phone!="" && list.phone?contains('[]')==false>
     						<em class="caption">电话：</em>${list.phone}
     						<#elseif list.qq!="">
     						<em class="caption">QQ:</em>${list.qq}
     						<#elseif list.email!="">
     						<em class="caption">email:</em>${list.email}
     						</#if>
     						</a>
     					  </#if>
     					</td>
						
						<td align="center">${list.regionns}</td>
							
						<td>
							${list.moneys}<#if list.name1?? && list.name1!="">（${list.name1}<#if list.bank_id1?? && list.bank_id1!="">:${list.bank_id1}</#if>）</#if><br/>
							交款日期：<#if list.moneydate??>${list.moneydate?date}</#if><br/>
							扣除手续费后金额：
							<#if list.name1?? && list.name1!="">
							<#if list.name1=="POS刷卡" || list.name1=="POS刷卡（备用）">	
								<#if list.moneys??>
									<#if list.moneys gt 4487 >
										<#if list.regionns??>
											<#if list.regionns=="杭州景芳中心" || list.regionns=="南京雨花台中心">
												${list.moneys-30}
											<#else>
												${list.moneys-35}
											</#if>
										<#else>
											${list.moneys-35}
										</#if>
									<#else>
										${list.moneys-list.moneys*0.0078}
									</#if>
								</#if>
							<#else>
								${list.moneys}
							</#if>
							</#if>
						</td>
						<td align="center">${list.beizhu}</td>
						<td align="center">
						<#if list.pz_url?? && list.pz_url!="">
							<#list list.pz_url?split(",") as name>
							<#if name_index !=0>
								<a target="_blank" href="http://www.yueqiao.org${name}"><img rel="800:485" width="180" height="109.125" src="http://www.yueqiao.org${name}"></a>
							</#if>
							</#list>
						</#if>
						</td>
					</tr>
					<tr id="__TRACKING_LIST${list.id}" style="display:none">
	            		<td colspan="10" class="trackinglst" id="trackList${list.id}">
	            		</td>
	            	</tr>
				</#list>
			</#if>
		</table>
	</div>
	<div class="emptyline"></div>
</body>
</html>